class Solution:
    def secondHighest(self, s: str) -> int:
        biggest = 10
        for i in range(9, -1, -1):
            if str(i) in s:
                if biggest == 10:  # 没有找到过数字
                    biggest = i
                elif i != biggest:
                    return i
        return -1


if __name__ == "__main__":
    print(Solution().secondHighest("dfa12321afd"))  # 2
    print(Solution().secondHighest("abc1111"))  # -1
